package containerizedengine

import (
	"context"
	"github.com/containerd/containerd"
	"github.com/containerd/containerd/containers"
	"github.com/containerd/containerd/content"
)

const (
	containerdSockPath = "/run/containerd/containerd.sock"
	engineNamespace    = "com.docker"
)

type baseClient struct {
	cclient containerdClient
}

// containerdClient 抽象了containerd客户端，以帮助提高可测试性
// containerdClient abstracts the containerd client to aid in testability
type containerdClient interface {
	Containers(ctx context.Context, filters ...string) ([]containerd.Container, error)
	NewContainer(ctx context.Context, id string, opts ...containerd.NewContainerOpts) (containerd.Container, error)
	Pull(ctx context.Context, ref string, opts ...containerd.RemoteOpt) (containerd.Image, error)
	GetImage(ctx context.Context, ref string) (containerd.Image, error)
	Close() error
	ContentStore() content.Store
	ContainerService() containers.Store
	Install(context.Context, containerd.Image, ...containerd.InstallOpts) error
	Version(ctx context.Context) (containerd.Version, error)
}
